<div class="panel">
	Student Section Master List      
  <div class="btn-group dropdown">
    <a href="<?=site_url('pdf/sectionmasterlist');?>" target="_blank" class="btn btn-primary"><i class="icon-print"></i> Print</a>
    <button class="btn dropdown-toggle" data-toggle="dropdown">Print Rosters<span class="caret"></span></button>
    <ul class="dropdown-menu">
      <!-- dropdown menu links -->
      <?foreach($levels as $lev):?>
        <li><a href="<?=site_url('pdf/printrosters/'.__link($lev->level_id));?>" class="generate-print" target="_blank" title="Continue to print? <?=$lev->level_desc;?>">Print: <?=$lev->level_desc;?></a></li>
      <?endforeach;?>
    </ul>
  </div>
</div>

  <div class="accord">
      <?if($sml):?>
      <!-- Loop grade level start -->
      <?foreach($sml as $k => $v):?>
      <h4><?=$v['level'];?></h4>
      <div style="padding:0;margin:0;">
      <table class="table table-striped table-hover">
      <thead>
        <tr>
          <td>STUDENT ID</td>
          <td>STUDENT NAME</td>
          <td>DATE ENROLLED</td>
          <td>GENDER</td>
        </tr>
      </thead>
        <tbody>
        <!-- Loop grade level sections start -->
        <?if(!empty($v['data'])):?>
          <?if(!empty($v['data'])):?> 
            <!-- Loop grade level section students start -->
            <?foreach($v['data'] as $dk => $dv):?>
                  <tr class="success">
                    <td colspan="4" class="center" ><div id="<?=$dv['id'];?>"></div><span class="label label-inverse"><?=$dv['section_name'];?></span></td>
                  </tr>
              <?if(!empty($dv['students'])):?>
                <?foreach($dv['students'] as $stud):?>
                  <tr>
                    <td><?=$stud->e_student_id;?></td>
                    <td><a href="<?=site_url('profile/student/'.$stud->enrollment_id);?>" target="_blank"><?=ucwords(strtolower($stud->fullname));?></a></td>
                    <td><?=$stud->regdate;?></td>
                    <td><?=$stud->gender;?></td>
                  </tr>
                <?endforeach;?>
              <?else:?>
                <tr>
                  <td colspan="4">No Students.</td>
                </tr>
              <?endif;?>
            <!-- Loop grade level section students end-->
            <?endforeach;?>
          <?else:?>
            <tr><td colspan="4">No Students.</td></tr>
          <?endif?>
        <!-- Loop grade level sections end -->
        <?else:?>
          <tr><td colspan="4">There are no sections for this grade Level</td></tr>
        <?endif;?>
        </tbody>
            
      </tbody>
      </table>
      </div>
      <!-- Loop grade level start -->
      <?endforeach;?>
      <?else:?>
          <tr><td colspan="4">No Data to show.</td></tr>
        <?endif;?>
    </div>

<script src="<?=script_url('custom/registrar_generate_roster_prints')?>"></script>
<script>$(document).ready(function(){
  var icons = {
      header: "ui-icon-circle-arrow-e",
      activeHeader: "ui-icon-circle-arrow-s"
    }
  $('.accord').accordion({
    heightStyle: "content",
    icons:icons
  });
});</script>